#include "startwindow.h"
#include "gamewindow.h"
#include <QApplication>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    StartWindow startWindow;
    GameWindow* gameWindow = nullptr;

    // 信号连接
    QObject::connect(&startWindow, &StartWindow::startGameRequested,
                     [&](int index) {
                         qDebug() << "Starting game with character index:" << index;
                         if(gameWindow) {
                             gameWindow->close();
                             gameWindow->deleteLater();
                         }
                         gameWindow = new GameWindow(index);
                         gameWindow->show();
                     });

    startWindow.show();
    return app.exec();
}
